package com.parking.common.web.config;

import com.parking.common.web.util.WebUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

@Component
public class TokenFilter implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        if(WebUtil.getRequest()!=null){
            String token = WebUtil.getRequest().getHeader("authorization");
            if(token!=null&&!token.equals("")){
                template.header("authorization",token);
            }
        }
    }
}
